home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_xtank3.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
2KB
|
71 lines
# Jedi Knight Cog Script
#
# XTANK3.COG
#
# This cog causes an attached object to explode if damaged sufficiently
#
# 5/23 - RKD - Removed buggy "remains" element
# 5/30 - YB - Don't explode if hit by fists.
# 7/7 - CR - Converted to actor cog
# Added delay in exploding
# 7/7 - YB - Rewrote the script to use thing user data
# 7/8 - CR - Adjusted Delay, fixed damage test, marked issue closed :)
# 7/25 - YB - Made execution mode SERVER | SYNC
# 8/26 - RKD - Added killtimerex to fix bug
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
flags=0x80
symbols
message created
message damaged
message timer
template barrel_exp=+xtank3_exp local
int barrel local
flex barrelhealth local
flex damage local
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 50); // set the initial user data (i.e. "health")
Return;
# ............................................................................................
damaged:
barrel = GetSenderRef();
damage = GetParam(0);
barrelhealth = GetThingUserData(barrel);
if(GetParam(1) == 1) Return; // barrel won't be damaged by damage type impact
if(barrelhealth <= damage) // is this enough damage to kill the barrel ?
{
SetTimerEx(0.80, barrel, 0, 0); // prepare to kill the barrel in 0.85 second
Return;
}
SetThingUserData(barrel, barrelhealth - damage);
Return;
# ............................................................................................
timer:
KillTimerEx(GetSenderId());
CreateThing(barrel_exp, GetSenderId()); // create an explosion
DestroyThing(GetSenderId()); // Destroy the barrel
Return;
end